import App from '../App'

const home = r => require.ensure([], () => r(require('../pages/home/home')), 'home')
const demo = r => require.ensure([], () => r(require('../pages/demo/demo')), 'demo')
const flex = r => require.ensure([], () => r(require('../pages/flex/flex')), 'flex')
const grid = r => require.ensure([], () => r(require('../pages/grid/grid')), 'grid')
const svgLoading = r => require.ensure([], () => r(require('../pages/svgLoading/svgLoading')), 'svgLoading')
const touchmove_prevent = r => require.ensure([], () => r(require('../pages/touchmove_prevent/touchmove_prevent')), 'touchmove_prevent')
const CSSSkill = r => require.ensure([], () => r(require('../pages/CSSSkill/CSSSkill')), 'CSSSkill')
const img = r => require.ensure([], () => r(require('../pages/img/img')), 'img')
const retinajs = r => require.ensure([], () => r(require('../pages/retinajs/retinajs')), 'retinajs')
const insertDemo = r => require.ensure([], () => r(require('../pages/insertDemo/insertDemo')), 'insertDemo')
const lazyload = r => require.ensure([], () => r(require('../pages/lazyload/lazyload')), 'lazyload')
const axios = r => require.ensure([], () => r(require('../pages/axios/axios')), 'axios')
const vuex = r => require.ensure([], () => r(require('../pages/vuex/vuex')), 'vuex')
const slide = r => require.ensure([], () => r(require('../pages/slide/slide')), 'slide')
const scrollAnimation = r => require.ensure([], () => r(require('../pages/scrollAnimation/scrollAnimation')), 'scrollAnimation')
const QRCode = r => require.ensure([], () => r(require('../pages/QRCode/QRCode')), 'QRCode')
const transition = r => require.ensure([], () => r(require('../pages/transition/transition')), 'transition')
const noticeTip = r => require.ensure([], () => r(require('../pages/noticeTip/noticeTip')), 'noticeTip')

const router = r => require.ensure([], () => r(require('../pages/router/router')), 'router')
const routerChildren = r => require.ensure([], () => r(require('../pages/router/children/index')), 'routerChildren')
const routerGrandson = r => require.ensure([], () => r(require('../pages/router/children/children/index')), 'routerGrandson')

const user = r => require.ensure([], () => r(require('../pages/user/user')), 'user')
export default [{
  path: '/',
  component: App, //顶层路由，对应index.html
  children: [ //二级路由。对应App.vue
    //地址为空时跳转home页面
    {
      path: '',
      redirect: '/home',
      meta: { index: '10' }//index记录页面全换方式
    },
    //首页
    {
      path: '/home',
      component: home,
      meta: { index: '10' }
    },
    //user
    {
      path: '/user',
      component: user,
      meta: { index: '13' }
    },
    //demo
    {
      path: '/demo',
      component: demo,
      meta: { index: '20' }
    },
    //flex布局
    {
      path: '/flex',
      component: flex,
      meta: { index: '20' }
    },
    //grid布局
    {
      path: '/grid',
      component: grid,
      meta: { index: '20' }
    },
    //svg加载 loading
    {
      path: '/svgLoading',
      component: svgLoading,
      meta: { index: '20' }
    },
    //touchmove_prevent 弹出层阻止内层滑动
    {
      path: '/touchmove_prevent',
      component: touchmove_prevent,
      meta: { index: '20' }
    },
    //CSSSkill css技巧
    {
      path: '/CSSSkill',
      component: CSSSkill,
      meta: { index: '20' }
    },
    //img 图片处理
    {
      path: '/img',
      component: img,
      meta: { index: '20' }
    },
    //视网膜图片
    {
      path: '/retinajs',
      component: retinajs,
      meta: { index: '20' }
    },
    //插入100000条数据
    {
      path: '/insertDemo',
      component: insertDemo,
      meta: { index: '20' }
    },
    //图片懒加载
    {
      path: '/lazyload',
      component: lazyload,
      meta: { index: '20' }
    },
    //请求数据axios
    {
      path: '/axios',
      name: 'axios',
      component: axios,
      meta: { keepAlive: true, index: '20' }
    },
    //vuex
    {
      path: '/vuex',
      name: 'vuex',
      component: vuex,
      meta: { index: '20' }
    },
    //slide 滑动组件
    {
      path: '/slide',
      name: 'slide',
      component: slide,
      meta: { index: '20' }
    },
    //滑动动画
    {
      path: '/scrollAnimation',
      name: 'scrollAnimation',
      component: scrollAnimation,
      meta: { index: '20' }
    },
    //创建二维码
    {
      path: '/QRCode',
      name: 'QRCode',
      component: QRCode,
      meta: { index: '20' }
    },
    //特效动画
    {
      path: '/transition',
      name: 'transition',
      component: transition,
      meta: { index: '20' }
    },
    //组件书写
    {
      path: '/noticeTip',
      name: 'noticeTip',
      component: noticeTip,
      meta: { index: '20' }
    },
    //嵌套路由
    {
      path: '/router',
      component: router,
      meta: { index: '20' },
      children: [{
        path: 'routerChildren',
        component: routerChildren,
        meta: { index: '201' },
        children: [{
          path: 'routerGrandson',
          component: routerGrandson,
          meta: { index: '2011' }
        }]
      }]
    }
  ]
}]
